package Thread;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @description:
 * @author: cyy
 **/
public class yule {


    private static final List<Integer> list = new ArrayList<>();

    static {
        Random random = new Random();
        int i = 0;
        while (i < 10) {
            list.add(random.nextInt(100));
            i++;
        }
    }

    public static void main(String[] args) {
        //设置截取数(list.size() + max - 1) / max)
        int max = 3;
        List<List<Integer>> collect = Stream.iterate(0, n -> n + 1)
                .limit((list.size() + max - 1) / max)
                .parallel().map(a -> list.stream().sorted().skip(a * max)
                        .limit(max).parallel().collect(Collectors.toList())).collect(Collectors.toList());
        collect.stream().forEach(System.out::println);
    }
}
